Repository navigation
fix(plugin-chatbot): the AI quota notice offers an upgrade only when the refusal names one - #37390
Conversation
…pgrade / topUp Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXJvjbLQ6k5N7EjZqb
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXJvjbLQ6k5N7EjZqb
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXJvjbLQ6k5N7EjZqb
|
repo:cloud#1 · os-warren · session_01JQwxbXJvjbLQ6k5N7EjZqb Contract reviewServed-tier: ① Derived judgmentsFace: the ② Semver levelAdditive key in a published language pack: patch per the repo's changeset practice for added locale keys (precedent 6cc6177, #37340, ③ Boundary flagsDev flags: none open ( ④ Design judgmentNot owed on the declaration face. Implemented-by: VERDICT: PASS |
|
repo:cloud#1 · os-warren · session_01JQwxbXJvjbLQ6k5N7EjZqb 席位核对Verdict: ACCEPT at head
|
Requested by Warren · project thread
Refs objectstack-ai/cloud#4853
Clause-②: yes (widening) — one new published language-pack key,
chatbotQuota.limitTitle, in every localeMetadata-protocol: none
维护者速读
What changes
useAiQuotaCopy(plugin-chatbotChatbotEnhanced.tsx) now returns atitleand a nullablecta, both read from the refusal's ownupgrade/topUpflags (already parsed byparseAiQuotaError):topUp: true→ neutral title, "Buy a credit pack" action (unchanged action, title no longer says upgrade);upgrade: true→ "Upgrade needed" + "Upgrade plan" (unchanged);upgrade:falseand notopUpkey) → neutral title and no action; the server's sentence already says when it frees up.ErrorBanner's quota branch andQuotaBlockedNextStep(confirm card blocked state) render the action only whenctais set, same gating as the dock'sAiUsageIndicator/ChatDock(pool.upgrade || pool.topUp).chatbotQuota.limitTitle("AI limit reached" / 「AI 额度已用尽」) in all 11@object-ui/i18nlocales that carrychatbotQuota.*.@object-ui/plugin-chatbot,@object-ui/i18n).Mechanism check: the composer receives the cloud guardrail's 429 (cloud main e09f45c,
ai-token-guardrail-plugin.ts), which carries noplanType/resetKind, onlyerror.details.{messageEn, upgrade, topUp, resetsTonight, resetsAt}. Test fixtures are that body per plan; the card's usage-door words are in the test names so the acceptance reads 1:1.Tests
Targeted + package runs, ablation
ChatbotEnhanced.quotaResetPromise-7587.test.tsx(zh pack viaI18nProvider): paid five-hour{planType:'paid', resetKind:'fiveHour', upgrade:false, topUp:false}→ no 「需要升级」, no 「升级方案」 button, zero buttons, text exactlyAI 额度已用尽+ server sentence; developer plan → no heading, no button; paid weeklytopUp:true→ 「购买额度包」 callsonUpgrade, no 「升级方案」; freeupgrade:true→ heading and 「升级方案」 stay.ChatbotEnhanced.quotaBlockedConfirm.test.tsx: paid five-hour on the confirm card → reason shown,proposed-changes-quota-upgradeabsent.pnpm --dir ui exec vitest run packages/plugin-chatbot/ packages/i18n/→ Test Files 214 passed (214), Tests 3103 passed, 13 skipped.pnpm --filter @object-ui/plugin-chatbot --filter @object-ui/i18n run type-check→ both Done, exit 0.ChatbotEnhanced.tsxrestored to the merge base,limitTitlecount 0 on disk): 4 failed / 8 passed — the three new non-free banner cases and the confirm-card case red, the free case green as expected; restored withgit checkout HEAD --, blob hash matched HEAD.Acceptance notes
topUpwins the action, as before.Co-Authored-Bycommit trailer; the pre-push gatecheck:commit-card-trailersrefuses model identifiers, so commits carry the model-free pair.Verification
Derived gate families at head 935c1d8
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands: 41 families derived from the merge base b8c8c88; all 41 run locally, each exit 0 (40 unlockedcheck:*/ self-tests;pnpm --dir ui exec vitest run scripts/under the verify lock: Test Files 172 passed, 2 skipped; Tests 5130 passed).--ranreconciliation: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.Lint UI,Test UI,Build & E2E UI,Live E2E UI) are CI's.Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.quotaResetPromise-7587.test.tsx— expect 6 passed, including theresetKind fiveHourcase.Read first:
ChatbotEnhanced.tsxuseAiQuotaCopy(the title/cta choice is the risk hunk), thenErrorBanner's quota branch.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbXJvjbLQ6k5N7EjZqb